<?php (!defined('IN_SYSTEM') || !defined('ADMIN_PRE')) && exit('Access Denied!');?>
{admintemplate header}
<div class="box">
	<div class="heading">
	<h1>导航列表</h1>
	<div class="buttons">
	<a href="{url admin.php?m=nav&f=add&navtype=$navtype}" class="fr">添加导航</a>
	{loop $navtypes $k $v}
	<a href="{url admin.php?m=nav&navtype=$k}" {if $navtype==$k}class="current"{/if}>{$v}</a>
	{/loop}
	</div>
	</div>
	<div class="main">

		<div class="search">
			<form name="search" method="get" action="admin.php">
			<input type="hidden" name="m" value="nav" />
			<input type="hidden" name="f" value="index" />
				<fieldset>
					<legend>导航查找</legend>
						关键字：
						<input type="text" name="keyword" size="15" value="{urldecode($keyword)}" />
						<input type="submit" name="s" class="button" value="开始查找" />
						<input type="button" class="button" value="显示所有" onclick="window.location.href='admin.php?m=nav&f=index'" />
						<input type="button" class="button" value="添加导航" onclick="window.location.href='admin.php?m=nav&f=add&navtype={getGP('navtype')}'" />
				</fieldset>
			</form>
		</div>

		<form name="update" method="post" action="?m=nav">
		<input type="hidden" id="f" name="f" />
			<table cellspacing="0" class="list" id="list">
			<thead>
				<tr>
					<td width="1" class="center"></td>
					<td width="150"  class="left">名称</td>
					<td>链接</td>
					<td>描述</td>
					<td width="100">类型</td>
					<td width="80">启用</td>
					<td width="80">排序</td>
					<td width="80">权限</td>
					<td width="80">操作</td>
				</tr>
				</thead>
				{php $groups = $_G['userobj']->user_group();}
				{loop $groups  $g}
				{php $group[$g['gid']]=$g['groupname'];}
				{/loop}
{loop $result $row}
				<tr id="row_{$row['id']}">
					<td class="center"><input type="checkbox" name="id[]" value="{$row['id']}" class="checkbox" /></td>
					<td>{if $subnav[$row['id']]}<a onclick="get_child({$row['id']},this)" href="javascript:;">[+]</a>&nbsp;&nbsp;&nbsp;{/if}<a href="?m=nav&f=edit&id={$row['id']}">{$row['name']}</a></td>
					<td>
					{if stripos($row['url'],'http')===false}
					<a href="go/{$row['url']}" target="_blank">{$row['url']} </a>&nbsp;[<span onclick="setCopy('{BASE_URL}go/{$row[url]}')">复制</span>]
					{else}<a href="{$row['url']}" target="_blank">{$row['url']}</a>{/if}</td>
					<td>{$row['title']}</a></td>
					<td align="center"><a href="?m=nav&navtype={$row['navtype']}">{$navtypes[$row['navtype']]}</a></td>
					<td align="center">{if $row['visible']}<a href="?m=nav&visible=yes" class="suc">启用</a>{else}<a href="?m=nav&visible=no" class="err">禁用</a>{/if}</td>
					<td align="center"><input type="text" name="displayorder[{$row['id']}]" value="{$row['displayorder']}" size="5" class="input" /></td>
					<td>{$group[$row['access']]}</td>
					<td align="center"><a href="?m=nav&f=edit&id={$row['id']}">编辑</a></td>
				</tr>
				{if $subnav[$row['id']]}
				<tbody id="subnav_{$row['id']}" style="display:none;">
				{loop $subnav[$row['id']] $row}
				<tr id="row_{$row['id']}">
					<td class="center"><input type="checkbox" name="id[]" value="{$row['id']}" class="checkbox" /></td>
					<td><a href="?m=nav&f=edit&id={$row['id']}">{$row['name']}</a></td>
					<td>
					{if stripos($row['url'],'http')===false}
					<a href="go/{$row['url']}" target="_blank">{$row['url']} </a>&nbsp;[<span onclick="setCopy('{BASE_URL}go/{$row[url]}')">复制</span>]
					{else}<a href="{$row['url']}" target="_blank">{$row['url']}</a>{/if}</td>
					<td>{$row['title']}</a></td>
					<td align="center"><a href="?m=nav&navtype={$row['navtype']}">{$navtypes[$row['navtype']]}</a></td>
					<td align="center">{if $row['visible']}<a href="?m=nav&visible=yes" class="suc">启用</a>{else}<a href="?m=nav&visible=no" class="err">禁用</a>{/if}</td>
					<td align="center"><input type="text" name="displayorder[{$row['id']}]" value="{$row['displayorder']}" size="5" class="input" /></td>
					<td>{$group[$row['access']]}</td>
					<td align="center"><a href="?m=nav&f=edit&id={$row['id']}">编辑</a></td>
				</tr>
				{/loop}
				</tbody>
				{/if}
{/loop}
				<tr>
					<td class="center"><input type="checkbox" class="checkbox" value="1" name="chkall" onclick="check_all(this)" /></td>
					<td colspan="8">{pager($num,$pagesize,$page,$url)}全选 
					<input type="radio" name="f" value="resort" id="resort" class="radio" checked="checked" onclick="$('#span_move').hide()" /><label for="resort">排序</label> 
					<input type="radio" name="f" value="delete" id="delete" class="radio" onclick="$('#span_move').hide()" /><label for="delete">删除</label> 
					<input type="radio" name="f" value="move" id="move" class="radio" onclick="$('#span_move').show()" /><label for="move">移动到</label>
					<span id="span_move" style="display:none">
					<select name="navtype">
						<option value="">请选择</option>
						{loop $navtypes $k $v}
						<option value="{$k}">{$v}</option>
						{/loop}
					</select>
					</span>
					<input type="submit" class="button" value="执行操作"/></td>
				</tr>
			</table>
		</form>
		<script type="text/javascript">
		function get_child(id,obj){
			var obody = document.getElementById('subnav_'+id);
			if(obody.style.display == 'none') {
				obody.style.display = '';
				obj.innerHTML = '[-]';
			} else {
				obody.style.display = 'none';
				obj.innerHTML = '[+]';
			}
		}
		</script>
	</div>
</div>
{admintemplate footer}